home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / Hacking / Windows NT server bugs.sit / Windows NT server bugs next >
Text File  |  1997-01-21  |  19KB  |  465 lines

  1. New! If you are running Windows NT or Windows 95 you can
  2.                     Test whether your connection to the internet is safe! 
  3.                                               Right Now. 
  4.  
  5.  
  6.  
  7.                  Microsoft Internet Information Server v 1.0 
  8.                           "BAT/CMD" Security Bug, Part I. 
  9.  
  10.  
  11.  
  12.                   0. Abstract 
  13.  
  14.       .bat and .cmd BUG is well-known in Netscape server and described in WWW security FAQ Q59.
  15.       Implementation of this bug (undocumented remote administration feature) in MicroSoft IIS
  16.       Web server beats the all top scores. 
  17.  
  18.  
  19.  
  20.                   1. Default Configuration 
  21.  
  22.       Let's consider fresh IIS Web server installation where all settings are default: 
  23.  
  24.       1) CGI directory is /scripts 
  25.  
  26.       2) There are no files abracadabra.bat or abracadabra.cmd in the /scripts directory. 
  27.  
  28.       3) IIS Web server maps .bat and .cmd extensions to cmd.exe. Therefore registry key 
  29.  
  30.       HKEY_LOCAL_MACHINE\
  31.       SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\ScriptMap 
  32.  
  33.       has the following string: 
  34.  
  35.       .bat or .cmd=C:\WINNT35\System32\cmd.exe /c %s %s 
  36.  
  37.  
  38.  
  39.                   2. Attack
  40.  
  41.       In this case a hacker with a malicious intent can send either one of the two command lines to
  42.       the server: 
  43.             a) /scripts/abracadabra.bat?&dir+c:\+?&time 
  44.             b) /scripts/abracadabra.cmd?&dir+c:\+?&time 
  45.       and the following happens:
  46.  
  47.       1) Browser asks how you want to save a document. Notepad.exe or any other viewer would do
  48.       for this "type" of application. 
  49.  
  50.       2) Browser starts the download session. The download window appears on the screen. 
  51.  
  52.       3) The hacker clicks the "cancel" button on the download window, because the "time"
  53.       command on the server never terminates. 
  54.  
  55.       4) Nothing is logged on the server side by the IIS Web server, because the execution process
  56.       was not successfully terminated!!! (Thanks to the "time" command.) The only way to see that
  57.       something happened is to review all your NT security logs. But they do not contain
  58.       information like REMOTE_IP. Thus the hacker's machine remains fully anonymous. 
  59.  
  60.  
  61.  
  62.                   3. Resume
  63.  
  64.       1) IIS Web server allows a hacker to execute his "batch file" by typing
  65.       /scripts/abracadabra.bat?&COMMAND1+?&COMMAND2+?&...+?&COMMANDN 
  66.       In a similar situation with the Netscape server, only single command can be executed. 
  67.  
  68.       2) There is no file abracadabra.bat in /scripts directory, but .bat extension is mapped to
  69.       C:\WINNT35\System32\cmd.exe 
  70.       In a similar situation with the Netscape server, actual .bat file must exist. 
  71.  
  72.       3) In case a hacker enters a command like "time" or "date" as COMMAND[N], nothing will be
  73.       logged by IIS Web server. 
  74.       In a similar situation with the Netscape server, the error log will have a record about remote
  75.       IP and command you trying to execute. 
  76.  
  77.  
  78.  
  79.                   4. Workaround
  80.  
  81.       Disable .BAT and .CMD file extensions for external CGI scripts in file mapping feature of IIS
  82.       Web server. 
  83.  
  84.  
  85.  
  86.                   5. Reply from MicroSoft
  87.  
  88.       We sent the description of this bug to MicroSoft. Here one can see their reply and
  89.       acknowledgement. 
  90.  
  91.  
  92.       NOTE: 
  93.  
  94.       We have studied MicroSoft bug "fix" and found out that the problem has not been fixed! If one
  95.       uses a little bit more complicated command string, an arbitrary command on a server can be
  96.       still effectively executed. And again, nothing will be logged by IIS. More information is
  97.       available here . 
  98.  
  99.  
  100.       OTHER REFERENCES 
  101.             "BAT/CMD" Security Bug in IIS, Part I . 
  102.             "BAT/CMD" Security Bug in IIS, Part II . 
  103.             "4 - BUG" Alert: MS IIS, Netscape Alert . 
  104.             "4 - BUG" Report: MS IIS, Netscape Report . 
  105.             Windows NT Administrator's Password Recovery Program - PasswordNT ® 
  106.             Windows NT Password Cracker - ScanNT ® 
  107.  
  108.  
  109.  
  110.                                   [NT and Net Security Services] 
  111.  
  112.                               1996 © MWC Inc. -- Powered by OMNA ® Digital 
  113.  
  114.  
  115.  
  116.  
  117. New! If you are running Windows NT or Windows 95 you can
  118.                     Test whether your connection to the internet is safe! 
  119.                                               Right Now. 
  120.  
  121.  
  122.  
  123.                  Microsoft Internet Information Server v 1.0 
  124.                          "BAT/CMD" Security Bug, Part II. 
  125.  
  126.  
  127.  
  128.                   0. Abstract 
  129.  
  130.       .bat and .cmd BUG for Microsoft Internet Information Server is described here . Microsoft
  131.       claims to fix this problem. The patch is available from the Microsoft's site. We have studied
  132.       this patch and found out that the problem has not been fixed! If one uses a little bit more
  133.       complicated command string, an arbitrary command on a server can be still effectively
  134.       executed. And again, nothing will be logged by IIS. 
  135.  
  136.  
  137.  
  138.                   1. Default Configuration 
  139.  
  140.       We will consider the following settings: 
  141.  
  142.       1) IIS Web server with the .bat/.cmd patch from Microsoft installed. (or IIS downloaded after
  143.       March 5, 1996) 
  144.  
  145.       2) CGI directory is /scripts 
  146.  
  147.       3) Consider test.bat in the /scripts directory: 
  148.             @echo off 
  149.             echo Content-type: text/plain 
  150.             echo. 
  151.             echo Hello World! 
  152.  
  153.       4) IIS Web server maps .bat and .cmd extensions to cmd.exe. Therefore registry key 
  154.  
  155.       HKEY_LOCAL_MACHINE\
  156.       SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\ScriptMap 
  157.  
  158.       has the following string: 
  159.  
  160.       .bat or .cmd=C:\WINNT35\System32\cmd.exe /c %s %s 
  161.  
  162.  
  163.  
  164.                   2. Attack 
  165.  
  166.       In this case a hacker with a malicious intent can send this command line to the server: 
  167.             /scripts/test.bat+%26dir+%26time+%26abracadabra.exe 
  168.       with the results described in details previously . 
  169.  
  170.       The good news is that now file test.bat must be actually present in scripts
  171.       directory. 
  172.  
  173.  
  174.  
  175.                   3. Resume 
  176.  
  177.       As long as IIS does not log information about unsuccessful hits there are the ways for hackers
  178.       to break your entire NT box. I don't want to discuss this matter in more details, but our
  179.       network security partners recommend to avoid the usage of IIS because of an even more
  180.       severe "purple security bug," which they recently have discovered in IIS. 
  181.  
  182.  
  183.  
  184.                   4. Workaround 
  185.  
  186.       Disable .BAT and .CMD file extensions for external CGI scripts in file mapping feature of IIS
  187.       Web server or don't use .bat or .cmd files as a scripts. 
  188.  
  189.  
  190.       OTHER REFERENCES 
  191.             "BAT/CMD" Security Bug in IIS, Part I . 
  192.             "BAT/CMD" Security Bug in IIS, Part II . 
  193.             "4 - BUG" Alert: MS IIS, Netscape Alert . 
  194.             "4 - BUG" Report: MS IIS, Netscape Report . 
  195.             Windows NT Administrator's Password Recovery Program - PasswordNT ® 
  196.             Windows NT Password Cracker - ScanNT ® 
  197.  
  198.  
  199.  
  200.                                   [NT and Net Security Services] 
  201.  
  202.                               1996 © MWC Inc. -- Powered by OMNA ® Digital 
  203.  
  204.  
  205.  
  206. New! If you are running Windows NT or Windows 95 you can
  207.                      test whether your connection to the internet is safe 
  208.                                               Right Now! 
  209.  
  210.  
  211.  
  212.           Microsoft Internet Information Server vv. 1.x, 2.0b 
  213.                                New Security Bugs Alert. 
  214.                                         June 30, 1996 
  215.  
  216.  
  217.  
  218.                   0. Abstract 
  219.  
  220.       MWC, Inc. has discovered a new series of bugs ("4bugs") in the MS IIS in addition to
  221.       the "BAT/CMD" bug Part I and Part II. 
  222.  
  223.  
  224.  
  225.                   1. What these new bugs allow to do.
  226.  
  227.       The First bug allows a user to access any file on the same partition where your wwwroot
  228.       directory exists (assuming that IIS_user has permission to read this file). It also allows
  229.       execution of any executable file on the same partition where your scripts directory exists
  230.       (assuming that IIS_user has permission to execute this file). If cmd.exe file can be executed
  231.       then it also allows you to execute any command and read any file on any partition (assuming
  232.       that IIS_user has permission to read or execute this file). This bug is similar (but not the
  233.       same) as the one discovered independently by James@superstation.net. For more
  234.       information and the ISAPI filter DLL that fixes the problem take a look at this page 
  235.  
  236.       The Second and Third bugs exploit passing of unchecked arguments to the cmd.exe in a
  237.       way similar to the "BAT/CMD" bug . These bugs allow you to create new or to modify existing
  238.       files on any partition under the following conditions: 
  239.             BAT and (or) CMD files are mapped by IIS to the cmd.exe file 
  240.             IIS_USER has a right to create a file in case of a new file creation 
  241.             IIS_USER has a right to delete a file in case of a file modification 
  242.  
  243.       Unfortunately Netscape Communication and Netscape Commerce servers have
  244.       similar bugs. Similar things can be done with Netscape Server if it uses BAT or
  245.       CMD files as CGI scripts. We did not test all Web servers available on the market.
  246.       But some of them are vulnerable too. 
  247.  
  248.       The Fourth bug is specific to the cmd.exe program. Once accessed (for example by
  249.       exploiting the first bug) cmd.exe can be used to execute any internal command or any
  250.       command on any partition, share, etc., or it can be used to create a new "custom made" file
  251.       even if the mapping to the BAT, CMD files is disabled. 
  252.  
  253.  
  254.  
  255.                   2. Alert 
  256.  
  257.       MWC, Inc. has sent detailed bugs report to Microsoft. People at Microsoft we talked to are
  258.       very concerned about their customers and thus the fixes from Microsoft should be available
  259.       soon. 
  260.       MWC, Inc. has sent the report to Netscape as well. 
  261.       MWC, Inc. will send the copy of the report immediately to Every Web Server Developer
  262.       Company to let them test whether their Web Server is vulnerable to the second and third
  263.       bugs. 
  264.       MWC, Inc. will publish the detailed report about the bugs on July 3, 1996 at 10:00 pm EST
  265.       at this URL. We believe that the delay between this alert and the actual bugs report
  266.       publications will help Webmasters to reconfigure their websites before the information will
  267.       be available to the general public. 
  268.       MWC, Inc. will send the report about the bugs by e-mail to all registered users on July 3,
  269.       1996 at 10:00 pm EST. Register on-line to receive your copy of report by e-mail. 
  270.  
  271.  
  272.  
  273.                   3. Conclusions and Workaround 
  274.  
  275.       Regardless of the Web server you are using, create separate partitions for your
  276.       wwwroot directories and scripts directories to be on the safe side. 
  277.       Disable BAT/CMD files' mapping and never use BAT and (or) CMD files as CGI
  278.       scripts. 
  279.  
  280.  
  281.  
  282.                                   [NT and Net Security Services] 
  283.  
  284.                                  1996 © MWC -- Powered by OMNA Digital 
  285.  
  286.  
  287.  
  288.  
  289. New! If you are running Windows NT or Windows 95 you can
  290.                      test whether your connection to the internet is safe! 
  291.                                               Right Now! 
  292.  
  293.  
  294.  
  295.           Microsoft Internet Information Server vv. 1.x, 2.0b 
  296.                           "4BUGs" Security Bugs REPORT. 
  297.                                           July 3, 1996 
  298.  
  299.  
  300.  
  301.                   0. Abstract 
  302.  
  303.       MWC, Inc. has discovered a new series of bugs in the MS IIS in addition to the
  304.       "BAT/CMD" bug Part I and Part II. 
  305.  
  306.  
  307.  
  308.                   1. The 4 Bugs 
  309.  
  310.       [DOUBLE DOT] [TRUNCATE] [REDIRECT] [CMD.EXE]   
  311.  
  312.         
  313.  
  314.       "DOUBLE DOT" Bug allows intruder to access any file on the same partition where your
  315.       wwwroot directory is located (assuming that IIS_user has permission to read this file). It
  316.       also allows intruder to execute any executable file on the same partition where your
  317.       scripts directory is located (assuming that IIS_user has permission to execute this file). If
  318.       cmd.exe file can be executed than it also allows intruder to execute any command and read
  319.       any file on any partition (assuming that IIS_user has permission to read or execute this file). 
  320.  
  321.       The command 
  322.  
  323.             http://[domain_name]/..\..\..\..\[PATH]\filename 
  324.  
  325.       allows intruder to download any file on the same partition where the wwwroot directory is
  326.       located. 
  327.  
  328.       The commands 
  329.  
  330.             http://[domain_name]/scripts/../../../../[PATH]/filename 
  331.             or
  332.             http://[domain_name]/scripts/..\..\..\..\[PATH]\filename 
  333.  
  334.       allow intruder to execute any executable file on the same partition where your scripts
  335.       are located. 
  336.  
  337.       Note: This bug is similar (but not the same one) as discovered independently by
  338.       James@superstation.net. For more information and the ISAPI filter DLL that fixes the problem
  339.       take a look at this page 
  340.  
  341.         
  342.  
  343.       "TRUNCATE" Bug allows intruder to create new or to truncate existing files on any
  344.       partition under the following conditions: 
  345.             BAT and (or) CMD files are mapped by IIS to the cmd.exe file 
  346.             IIS_USER has a right to create a file in case of a new file creation 
  347.             IIS_USER has a right to delete a file in case of a file modification 
  348.  
  349.       The command 
  350.  
  351.             http://[domain_name]/scripts/abracadabra.bat>FULL_PATH\filename.bat 
  352.  
  353.       will create a new file at the FULL_PATH drive:\directory location if the file
  354.       FULL_PATH\filename.bat does not exist. If the file exists and IIS_USER has permission to
  355.       delete this file, the file will be truncated. 
  356.  
  357.       The command 
  358.  
  359.             http://[domain_name]/scripts/abracadabra.bat>FULL_PATH\filename%0A%0Dabracadabra.bat
  360.  
  361.       will create a new file at the FULL_PATH drive:\directory location if the file
  362.       FULL_PATH\filename does not exist. If the file exists and IIS_USER has permission to delete
  363.       this file, the file will be truncated. 
  364.  
  365.       Note: File abracadabra.bat does not need to exist in the scripts directory. 
  366.  
  367.         
  368.  
  369.       "REDIRECT" Bug will redirect output from any CGI script to the file under the following
  370.       conditions: 
  371.             BAT and (or) CMD files are mapped to the cmd.exe file by IIS 
  372.             IIS_USER has a right to create a file in case of a new file creation 
  373.             IIS_USER has a right to delete a file in case of a file modification 
  374.  
  375.       The commands 
  376.  
  377.             http://[domain_name]/scripts/script_name<existing.bat>FULL_PATH\filename%0A%0Dabracadabra.bat
  378.  
  379.             or
  380.             http://[domain_name]/scripts/script_name<existing.bat>>FULL_PATH\filename%0A%0Dabracadabra.bat
  381.  
  382.       will redirect (or append) output from the existing script_name to the filename file at the
  383.       FULL_PATH (drive:\directory) location. 
  384.  
  385.       Note: Netscape Communication and Netscape Commerce servers have similar bugs. Similar
  386.       things can be done with the Netscape Server when using the BAT/CMD files as a CGI scripts.
  387.       We did not test all Web servers available on the market. But some of them are vulnerable too.
  388.  
  389.       The commands 
  390.  
  391.             http://[domain_name]/scripts/script.bat?>FULL_PATH\filename 
  392.             or
  393.             http://[domain_name]/scripts/script.bat?>>FULL_PATH\filename 
  394.  
  395.       will redirect (or append) output from the existing script_name to the filename file at the
  396.       FULL_PATH (drive:\directory) location. The bug is probably more dangerous in this case
  397.       because the Netscape Server runs by default under local system account. Intruder can also
  398.       use a "|" symbol under the Netscape server to transfer output from an existing BAT to every
  399.       executable in any partition. 
  400.  
  401.         
  402.  
  403.       "CMD.EXE" Bug is specific to the cmd.exe shell program. Once accessed (for example by
  404.       exploiting Double Dot bug) cmd.exe can be used to execute any internal command or any
  405.       command in any partition, it can be used to create a new "custom made" file even if the
  406.       mapping to the BAT/CMD files is disabled. 
  407.  
  408.       The commands: 
  409.  
  410.             http://[domain_name]/scripts/../../cmd.exe/?%2FC+any_command 
  411.             or
  412.             http://[domain_name]/scripts/../../cmd.exe/?%2FC+any_command>FULL_PATH\filename
  413.  
  414.             or
  415.             http://[domain_name]/scripts/../../cmd.exe/?%2FC+any_command>>FULL_PATH\filename
  416.  
  417.       will execute any internal command and redirect or append the output from the command
  418.       to a file. 
  419.  
  420.       In particular, the command: 
  421.  
  422.             http://[domain_name]/scripts/../../cmd.exe/?%2FC+echo+"hello,+World">c:\temp\hello.bat
  423.  
  424.       will create a file c:\temp\hello.bat containing the phrase "hello, World". This allows a
  425.       malicious user to create simple but dangerous files. For example these files can be used as
  426.       scripts for ftp.exe command. This potentially allows anybody to cause the ftp client on the
  427.       server to connect to the intruder's ftp server, download trojan horse programs etc. 
  428.  
  429.  
  430.  
  431.                   2. Alert 
  432.  
  433.       MWC, Inc. has sent detailed bugs report to Microsoft. The people at Microsoft we talked to
  434.       are very concerned about their customers and thus the patches from Microsoft should be
  435.       available soon. 
  436.       MWC, Inc. has sent the report to Netscape as well. 
  437.       MWC, Inc. will send a copy of the report immediately to any web server developer company
  438.       to let them test whether their Web Server vulnerable to the mentioned above bugs. 
  439.  
  440.  
  441.  
  442.                   3. Conclusions and Workaround 
  443.  
  444.       Regardless of the web server you are using, create separate partitions for your
  445.       wwwroot directories and scripts directories to be on the safe side. 
  446.       Disable BAT/CMD files' mapping and never use BAT/CMD files as CGI scripts. 
  447.       The real danger of the discovered bugs can not be underestimated. We demonstrated by
  448.       Simulated Intrusion Attack on a test computer at Windows NT Magazine lab that combination
  449.       of the bugs can completely void the security of an NT domain. Information about the SIA test
  450.       is scheduled for publication in one of the upcoming issues of WinNT Magazine. 
  451.  
  452.  
  453.  
  454.                   4. The Patch 
  455.  
  456.       According to reply from Microsoft, the patch for these bugs is now available at: 
  457.             http://www.microsoft.com/infoserv/iisservpack.htm 
  458.  
  459.  
  460.  
  461.                                   [NT and Net Security Services] 
  462.  
  463.                                  1996 © MWC -- Powered by OMNA Digital 
  464.  
  465.